package me.send.data.service.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import me.send.business.base.Pager;
import me.send.data.service.mapper.FeedbackMapper;
import me.send.data.service.pojo.Feedback;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FeedbackService {

	@Autowired
	private FeedbackMapper feedbackMapper;
	
	public List<Feedback> list(String phone,String start, String end,String type,Pager page) {
    	Map<String, Object> parameter = new HashMap<String, Object>();
    	parameter.put("phone", phone);
    	parameter.put("start", start);
    	parameter.put("end", end);
    	parameter.put("page", page);
    	if("broker".equals(type)){
    		List<Feedback> rows = feedbackMapper.list_broker(parameter);
    		return rows;
    	}else if("user".equals(type)){
    		List<Feedback> rows = feedbackMapper.list_user(parameter);
    		return rows;
    	}
    	return null;
    }
	
	public Integer count(String phone,String start, String end,String type) {
		Map<String, Object> parameter = new HashMap<String, Object>();
		parameter.put("phone", phone);
		parameter.put("start", start);
		parameter.put("end", end);
		if("broker".equals(type)){
			Integer rows = feedbackMapper.count_broker(parameter);
			return rows;
		}else if("user".equals(type)){
			Integer rows = feedbackMapper.count_user(parameter);
			return rows;
		}
		return 0;
	}
    
	

}
